#include "stdafx.h"

#include "Texture.h"

using namespace Hiranipra;
using namespace Hiranipra::Platform;
using namespace Hiranipra::Platform::Graphics;

Texture::Texture( GLuint textureId, uint32 width, uint32 height, uint32 channels ) :
	_textureId( textureId ), _width( width ), _height( height ),
	ITexture( BufferDefault, channels, width * height )
{
	// TODO: pixelFormat
}

Texture::~Texture()
{
	glDeleteTextures( 1, &_textureId );
	_textureId = 0;
}

void Texture::Activate( uint32 stage )
{
	glBindTexture( GL_TEXTURE_2D, _textureId );
}

bool Texture::Upload()
{
	if( this->IBuffer::Upload() == false )
		return false;

	// TODO: upload

	return true;
}

bool Texture::GetData( void* buffer, uint32 startIndex, uint32 elementCount ) const
{
	return true;
}

void Texture::SetData( const void* buffer, uint32 startIndex, uint32 elementCount, bool discard )
{
}
